package com.yan.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * TODO
 *
 * @Author: 汪焰
 * @Date: 2021/7/5 23:32
 */
@Configuration
public class RabbitConfig {

    //Queue
    @Bean
    public Queue queue() {
        return new Queue("queue.boot.name.yan", false, false, false, null);
    }

    //Exchange
    @Bean
    public Exchange exchange() {
        return new TopicExchange("exchange.boot.name.yan", false, false, null);
    }

    //Binding
    @Bean
    public Binding binding() {
        //创建一个绑定，不知道绑定的参数
        return new Binding("queue.boot.name.yan",
                Binding.DestinationType.QUEUE,
                "exchange.boot.name.yan",
                "key.boot.name.yan",
                null);
    }


}
